from PIL import Image
import matplotlib.pyplot as plt
import fitz
print(fitz.__doc__)

filename=r"D:\1\xx.pdf"
doc = fitz.open(filename)
toc = doc.get_toc()
print(toc)
print(doc)
for page in doc:
    pix = page.get_pixmap(matrix=fitz.Matrix(2, 2) )
    # pix.writeImage("page2-%i.png" % page.number)
    pix.save("page2-%i.png" % page.number)

'''
    pass

img= Image.open(r'E:\Img\img_align_celeba\000002.jpg')
img2=Image.open(r'E:\Img\img_align_celeba\000001.jpg')
img2 = img2.crop((50,50,100,100))
img.paste(img2,(0,0,50,50))
plt.imshow(img2)
plt.show()
plt.imshow(img)
plt.show()

'''

